home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Family Forum 259
/
IND_GIANT.BIN
/
Xtras
/
Animation Wizard.dir
/
00014_Script_CastMgr
< prev
next >
Wrap
Text File
|
1997-05-10
|
4KB
|
123 lines
-- CastMgr script
on birth me
return me
end birth
on mFindFreeCastRun me, howMany, startIndex
global gDevelopmentFlag
-- finds the first available run of "n" empty castmembers in the
-- specified "cast", starting at the offset designated by "index"
if gDevelopmentFlag then
set castNumberToStartLooking = 400 -- So I can find and delete generated cast members during dev.
else
set castNumberToStartLooking = startIndex
end if
-- find a run of "howMany" empty castmember slots
repeat while TRUE
tell the stage
-- castLib 1 is the internal cast of the stage movie
set startEmptyRun = findEmpty( member castNumberToStartLooking of castLib 1)
end tell
if howMany = 1 then -- Short curcuit for simple case
return startEmptyRun
end if
set OKRunFlag = TRUE
repeat with nextCastMember = (startEmptyRun + 1) to (startEmptyRun + howMany - 1)
if nextCastMember = 32000 then
alert("There is not enough free space in your cast to create this auto-animation. Delete any unused castmembers and try again." )
return 0
end if
tell the stage
set nextEmpty = findEmpty( member nextCastMember of castLib 1)
end tell
if nextEmpty <> nextCastMember then
set castNumberToStartLooking = nextCastMember
set OKRunFlag = FALSE
exit repeat
end if
end repeat
if OKRunFlag then
return startEmptyRun -- Got it, outa here
end if
end repeat
end mFindFreeCastRun
on mModifyRichTextCM me, theText, theFont, theSize
set theCastName = "RichText" && theFont && theSize
set theCastNum = the number of member theCastName
if theCastNum < 1 then
alert("Internal error: mModifyRichTextCM could not find" && theCastName)
return 0
end if
set the text of member theCastNum = theText
return theCastNum
end mModifyRichTextCM
-- No longer called
on mGetTextWidth me, theCastNum
set theName = the name of member theCastNum
set theFontNameAndSize = word 2 of theName & word 3 of theName
set saveText = the text of member theCastNum -- save away original
case theFontNameAndSize of
"Helvetica24": set theMWidth = 20
"Times24": set theMWidth = 22
"Palatino24": set theMWidth = 21
"Courier24": set theMWidth = 23
"HelveticaBold24": set theMWidth = 24
"TimesBold24": set theMWidth = 25
"PalatinoBold24": set theMWidth = 14
"CourierBold24": set theMWidth = 15
"Arial24": set theMWidth = 20
"TimesNewRoman24": set theMWidth = 21
"CourierNew24": set theMWidth = 14
"ArialBold24": set theMWidth = 24
"TimesNewRomanBold24": set theMWidth = 23
"CourierNewBold24": set theMWidth = 15
otherwise alert("Internal error, mGetTextwidth could find find :" & theFontNameAndSize)
end case
set originalHeight = the height of member theCastNum
set extraMs = 0
repeat while the height of member theCastNum = originalHeight
set extraMs = extraMs + 1
set the text of member theCastNum = (the text of member theCastNum) & "M"
end repeat
set extraMs = extraMs - 1
set fieldWidth = the width of member theCastNum
set sizeOfExtraMs = extraMs * theMWidth
set theRealWidth = fieldWidth - sizeOfExtraMs
set the text of member theCastNum = saveText -- restore original
return theRealWidth
end mGetTextWidth
-- No longer called
on mGetTextHeight me, theCastNum
-- The rect of a cast member gives you the size
-- of the text in the cast member. Item 4 is the
-- bottom, which is also the height
set theRect = the rect of member theCastNum
set theRectString = string(theRect)
set theWidthString = item 4 of theRectString
set theWidth = value(theWidthString)
return theWidth
end mGetTextHeight